﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace BUS
{
    public class Service_m2work
    {
        public static ServiceM2WorkRef.ClienUpLoadDTO _clientUpLoadDTO = new ServiceM2WorkRef.ClienUpLoadDTO();
        public static ServiceM2WorkRef.ClientFeedBackDTO _clientFeedBackDTO = new ServiceM2WorkRef.ClientFeedBackDTO();

        /// <summary>
        /// call method addrecordUpLoad in web service
        /// </summary>
        /// <param name="culDTO"></param>
        public static void AddRecordUpLoad()
        {
            ServiceM2WorkRef.Service1SoapClient service = new ServiceM2WorkRef.Service1SoapClient();
            service.AddRecordCompleted += new EventHandler<ServiceM2WorkRef.AddRecordCompletedEventArgs>(service_AddRecordCompleted);
            service.AddRecordAsync(_clientUpLoadDTO);
        }

        static void service_AddRecordCompleted(object sender, ServiceM2WorkRef.AddRecordCompletedEventArgs e)
        {
            if (e.Result)
            {
                MessageBox.Show("Thêm Thành Công", "Thông Báo", MessageBoxButton.OK);
            }
            else
            {
                MessageBox.Show("Thêm Thất Bại", "Thông Báo", MessageBoxButton.OK);
            }
        }

        public static void AddRecordFeedBack()
        {
            ServiceM2WorkRef.Service1SoapClient service = new ServiceM2WorkRef.Service1SoapClient();
            service.AddRecordToFeedBackCompleted += new EventHandler<ServiceM2WorkRef.AddRecordToFeedBackCompletedEventArgs>(service_AddRecordToFeedBackCompleted);
            service.AddRecordToFeedBackAsync(_clientFeedBackDTO);
        }
           static void  service_AddRecordToFeedBackCompleted(object sender, ServiceM2WorkRef.AddRecordToFeedBackCompletedEventArgs e)
        {
            if (e.Result)
            {
                MessageBox.Show("Gửi Thành Công", "Thông Báo", MessageBoxButton.OK);
            }
            else
            {
                MessageBox.Show("Gửi Thất Bại", "Thông Báo", MessageBoxButton.OK);
            }
        }
    }
}
